#ifndef LISTFACTORY_H_INCLUDED
#define LISTFACTORY_H_INCLUDED
#include <exception>
#include "list.h"
#include "ArrayList.h"
#include "LinkedList.h"

enum ListType{
    ARRAY_LIST = 0, LINKED_LIST = 1,
};

template <typename T>
class ListFactory{
protected:
    ListFactory(){
    }

public:
    static List<T>* GetListInstance(ListType type){
        try{
            switch(type){
            case ARRAY_LIST:
                return new ArrayList<T>();
            case LINKED_LIST:
                return new LinkedList<T>();
            default:
                return 0;
            }
        }catch(std::bad_alloc& e){
            return 0;
        }
    }

};

#endif // LISTFACTORY_H_INCLUDED
